List: Allow selection/highlighting of text in an item [QW] \ Implementation#32840
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adjusts dxList swipe wiring to better support use cases like text selection within list items by removing the internal _swipeEnabled switch and only attaching swipe listeners when there is an onItemSwipe subscription. It also updates Scheduler tooltip list options/tests accordingly.
Changes:
- Removed the internal
_swipeEnabledoption from ListBase and stopped passing it from Scheduler tooltip list creation. - Updated ListBase to attach swipe event handlers only when
onItemSwipeis subscribed. - Updated affected QUnit tests to reflect the new options shape (and attempted to update a swipe-related List test).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| packages/devextreme/testing/tests/DevExpress.ui.widgets/listParts/commonTests.js | Updates a List swipe test (currently inconsistent with actual options/behavior). |
| packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/desktopTooltip.tests.js | Updates assertions for Scheduler tooltip List options after removing _swipeEnabled. |
| packages/devextreme/js/__internal/ui/list/list.base.ts | Removes _swipeEnabled and changes swipe listener attachment to depend on action subscription. |
| packages/devextreme/js/__internal/scheduler/tooltip_strategies/m_tooltip_strategy_base.ts | Stops passing _swipeEnabled: false into tooltip List options. |
packages/devextreme/testing/tests/DevExpress.ui.widgets/listParts/commonTests.js
Outdated
Show resolved
Hide resolved
packages/devextreme/testing/tests/DevExpress.ui.widgets/listParts/commonTests.js
Outdated
Show resolved
Hide resolved
packages/devextreme/testing/tests/DevExpress.ui.widgets/listParts/commonTests.js
Outdated
Show resolved
Hide resolved
|
|
||
| return result; | ||
| } | ||
|
|
There was a problem hiding this comment.
are there any tests that checks resubscriptions in existing tests?
There was a problem hiding this comment.
we have test which checks onItemSwipe subscription by on method
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
You can also share your feedback on Copilot code review. Take the survey.
packages/devextreme/testing/tests/DevExpress.ui.widgets/listParts/commonTests.js
Outdated
Show resolved
Hide resolved
| pointerMock($item).start().down(0, 0).move(50, 0).up(); | ||
|
|
||
| assert.strictEqual(window.getSelection().toString(), textNode.nodeValue.slice(0, 4), 'text selection is preserved after horizontal drag'); | ||
| window.getSelection().removeAllRanges(); |
There was a problem hiding this comment.
You already call removeAllRanges at the module level inside the afterEach hook
There was a problem hiding this comment.
removed all extra calls
|
|
||
| const { $item, textNode } = getFirstListItemAndTextNode(this.element); | ||
| assert.ok(!!textNode, 'text node found in list item'); | ||
| if(!textNode) return; |
There was a problem hiding this comment.
Why we need to return here? I would prefer to remove it
| }); | ||
|
|
||
| const { $item, textNode } = getFirstListItemAndTextNode(this.element); | ||
| assert.ok(!!textNode, 'text node found in list item'); |
There was a problem hiding this comment.
It would be better to use strictEqual() instead
| const result = super.on(eventName, eventHandler); | ||
|
|
||
| const isItemSwipeOn = eventName === 'itemSwipe' | ||
| || (isPlainObject(eventName) && Object.prototype.hasOwnProperty.call(eventName, 'itemSwipe')); |
There was a problem hiding this comment.
| || (isPlainObject(eventName) && Object.prototype.hasOwnProperty.call(eventName, 'itemSwipe')); | |
| || (isPlainObject(eventName) && Object.hasOwn(eventName, 'itemSwipe')); |
There was a problem hiding this comment.
returned
Object.prototype.hasOwnProperty.call(eventName, 'itemSwipe')| on(eventName: string | { [key: string]: Function }, eventHandler?: Function): this { | ||
| const result = super.on(eventName, eventHandler); | ||
|
|
||
| const isItemSwipeOn = eventName === 'itemSwipe' |
There was a problem hiding this comment.
| const isItemSwipeOn = eventName === 'itemSwipe' | |
| const hasItemSwipeHandler = eventName === 'itemSwipe' |
0b422d2 to
2f7a9a5
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
You can also share your feedback on Copilot code review. Take the survey.
packages/devextreme/testing/tests/DevExpress.ui.widgets/listParts/commonTests.js
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
You can also share your feedback on Copilot code review. Take the survey.

No description provided.